package com.yangqi.ThreadDemo;
//完成场景 某人正在看电视剧，从第1~88集，看到第10集时，来了个送快递的，收完快递后，继续看电视剧
public class HomeWork2 {
    public static void main(String[] args) {
        Delivery delivery = new Delivery();
        Thread thread = new Thread(delivery);
        for (int i = 0; i < 99; i++) {
            System.out.println("正在看第" + i + "集");
            if(i == 10){
                thread.start();
                try {
                    thread.join();
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        }

    }
}
class Delivery implements Runnable{
    @Override
    public void run() {
        try {
            Thread.sleep(10000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        System.out.println("去拿外卖2222222222222222222222");
    }
}
